<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class=" definewidth m20">
	<form action="/sys_admin/systemadmin/admin_type_edit/" method="post" id="form" name="form">
	<input name="id" type=hidden value="<?php echo $id;?>">
	<font color="red"><?php echo @validation_errors(); ?></font>
		<table class="table table-bordered table-hover m10">
		 <tr>
	        <td class="tableleft">管理类型名称</td>
	        <td><input type="text" name="name" id="name" size="50" value="<?php echo $name;?>" /> </td>
	   	</tr>
	   	<tr>
	        <td class="tableleft">状态</td>
	        <td>
	        	<input type="radio" name="fstatus" value="1" <?php if($status==1) echo 'checked'?> />开通
				<input type="radio" name="fstatus" value="0" <?php if($status==0) echo 'checked'?>/>关闭
			</td>
	   	</tr>
	   	<tr>
	        <td class="tableleft"> 描述说明</td>
	        <td><input type="text" name="remark" id="remark" size="50"  value="<?php echo $remark;?>" /> </td>
	   	</tr>
	   	<tr>
	        <td class="tableleft"> 管理权限</td>
	        <td>
	        	<?php
				$module_arr = explode(',',$module);
				foreach ($type as $k=>$v){
					echo "<table class='table table-bordered table-hover m10'><tr><td class='tableleft' style='width: 80px;'>".$v['name']."</td><td >";
					foreach($v['list'] as $sk =>$sv){
			    ?>
				<input type="checkbox" name="module[]" id="module<?php echo $sk;?>" value="<?php echo $sk;?>" <?php if(array_key_exists(array_search($sk,$module_arr),$module_arr)) echo "checked"?>/>
				<?php
				     	echo "&nbsp;&nbsp;".$sv['linkname']."&nbsp;";
					}
					echo "</td></tr></table>";
				}
				?>
	        </td>
	   	</tr>
	   	<tr>
	        <td class="tableleft"></td>
	        <td> <button type="button" class="btn btn-success"  onclick="this.form.submit();" >提交</button> </td>
	   	</tr>
	   </table>
	</form>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formID:"form",debug:false,submitOnce:true,
		onError:function(msg,obj,errorlist){
			$("#errorlist").empty();
			$.map(errorlist,function(msg){
				$("#errorlist").append("<li>" + msg + "</li>")
			});
			alert(msg);
		},
		submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
	});
    $("#name").formValidator({autoModify:true,onShow:"",onFocus:"类型名称在1-20个汉字之间",onCorrect:""}).inputValidator({min:1,max:40,onError:"类型名称不能为空,请确认"});
	$(":checkbox[name='module[]']").formValidator({tipid:"moduleTip",onShow:"请选择管理模块",onFocus:"你至少选择1个管理模块",onCorrect:"恭喜你,你选对了"}).inputValidator({min:1,onError:"请选择管理权限"}); 
});
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>